package jarloader;

import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;

/**
 * @program: util
 * @description:
 * @author: zhouliangliang
 * @create: 2019-12-17 20:49
 **/
public class Loader extends URLClassLoader {
    public Loader(URL[] urls, ClassLoader parent) {
        super(urls, parent);
    }

    public void listResources() {
        try {
            Enumeration<URL> enu = this.getResources("META-INF/MANIFEST.MF");
            while (enu.hasMoreElements()) {
                URL next = enu.nextElement();
                System.out.println(next.toString());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


    public static void main(String[] args) throws Exception{
        String str = "http://maven.sankuai.com/repository/releases/com/sankuai/wmarch/map/facade/counter/GeoQueryServletGeoQueryAnalysis/191217.145030/GeoQueryServletGeoQueryAnalysis-191217.145030.jar";
        URL url = new URL(str);
        URL[] urls = new URL[]{url};
        new Loader(urls, Loader.class.getClassLoader()).listResources();
    }
}
